<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of welcome
 *
 * @author Obi
 */
class Admin_account extends MY_Controller {

    function __construct() {
        parent::__construct();
        $cek_admin = $this->session->userdata('cek_admin');
        if (!$cek_admin)
            redirect("admin");

        $this->maccount = new M_account();
		$data['title'] = 'Account Module';
    }

    function index() {
        
		$data['isi'] = 'main';
        $this->load->view('template_admin', $data);
    }
	function getTree() {
		$headAccount = $this->maccount->getHead();
		$data['getHead'] = $headAccount;
		$data['accParent_list'] = $this->maccount->getAccParent();
		$data['isi'] = 'isi';
		$this->load->view('template_admin',$data);
	}
	function tambah() {
		$data['accClass_list'] = $this->maccount->getAccClass();
		$data['accParent_list'] = $this->maccount->getAccParent();
        $data['isi'] = 'form';
        $this->load->view('template_admin', $data);
	}
	
	function edit($id=null) {
		$getData = $this->maccount->where("orderno = '$id'")->get();

        $data['id'] = $getData->account_code;
		$data['accClass_list'] = $this->maccount->getAccClass();
        $data['accParent_list'] = $this->maccount->getAccParent();
        $data['account_name'] = $getData->account_name;
        $data['account_sname'] = $getData->account_sname;
        
        $data['pdt_status'] = $getData->pdt_status;
        $data['isactive'] = $getData->isactive;

        $data['isi'] = 'form';
        $this->load->view('template_admin', $data);
	}
	
	function journal(){
		$data['isi'] = 'journal';
		$data['accCoa_list'] = $this->maccount->getAccMaster();
		$this->load->view('template_admin', $data);
	}

}

?>
